Skip to content

feat: URL params to records via JSON [DHIS2-17932]#23754

Merged
jbee merged 15 commits into
masterfrom
json-params
May 22, 2026
Merged

feat: URL params to records via JSON [DHIS2-17932]#23754
jbee merged 15 commits into
masterfrom
json-params

Conversation

@jbee

@jbee jbee commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds UrlParams marker interface to put on record classes that should be injected into an endpoint method. Any @Validation constraint in the record will be validated before mapping the request parameters to the record. In case of validation errors a BadRequestException is thrown (as it should be a "user error").

To test the concept I applied it to 2 cases, MinMaxDataElementParams and DataValueChangelogQueryParams.

Automated Testing

Existing tests got adjusted (mostly the test setup that was affected by the slightly different way of constructing params).
A new test was added for the URL parameter to JSON mapping.
As most of the actual implementation is within json-tree the relevent code is covered with many unit-tests in the library.

Manual Testing

  • test /api/minMaxDataElements?page=2&pageSize=5&fields=min&fields=source and vary URL parameters
  • test /api/audits/dataValue?page=2&fields=dataElement and vary URL parameters (in particular using values that should be rejected)

Documentation

@jbee jbee self-assigned this Apr 27, 2026
@jbee
jbee marked this pull request as ready for review May 21, 2026 11:23
@sonarqubecloud

Copy link
Copy Markdown

@jbee
jbee enabled auto-merge (squash) May 21, 2026 11:57

@david-mackessy david-mackessy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jbee
jbee merged commit 4ca7128 into master May 22, 2026
18 checks passed
@jbee
jbee deleted the json-params branch May 22, 2026 16:04
@jbee jbee changed the title feat: URL params to records via JSON feat: URL params to records via JSON [DHIS2-17932] May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants